﻿@model SEMS.Models.Student

@{
    ViewBag.Title = "Add";
    Layout = "~/Views/Admin/Shared/_Layout.cshtml";
}

<script src="../../../Scripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="../../../Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>

@Html.ValidationSummary(true, "添加失败!")
<h2>添加学生信息</h2>
@using (Html.BeginForm())
{
    <fieldset>
        <legend>添加学生信息</legend>
        <!--姓名-->
        <div class="editor-label">
            @Html.LabelFor(m => m.student_name)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(m => m.student_name)
            @Html.ValidationMessageFor(m => m.student_name)
        </div>
        <!--性别-->
        <div class="editor-label">
            @Html.LabelFor(m => m.student_sex)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(m => m.student_sex, new List<SelectListItem> { 
           new SelectListItem(){ Text = "男", Value = "男" }, 
           new SelectListItem(){ Text = "女", Value = "女" }})   <!--在Creat Post出错时没传SelectList进来，会出错，干脆不用传-->
            @Html.ValidationMessageFor(m => m.student_sex)
        </div>
        <!--学号-->
        <div class="editor-label">
            @Html.LabelFor(m => m.student_id)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(m => m.student_id)
            @Html.ValidationMessageFor(m => m.student_id)
        </div>
        <!--班级-->
        <div class="editor-label">
            @Html.LabelFor(m => m.class_id)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(m => m.class_id, (List<SelectListItem>)ViewBag.ClassList)
        </div>
        <!--小班号-->
        <div class="editor-label">
            @Html.LabelFor(m => m.class_small_id)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(m => m.class_small_id)
            @Html.ValidationMessageFor(m => m.class_small_id)
        </div>
        <input type="submit" value="确认添加" />

    </fieldset>
}
